const app = getApp();

Page({
  data: {
    orderInfo: {},
    phone:'',
  },
  onShareAppMessage() {
    return {
      title: '花礼鲜花玫瑰生日',
      desc: '花礼鲜花玫瑰生日',
      path: 'pages/todos/todos'
    };
  },
  onLoad(r){
    my.setNavigationBar({
      title: '订单详情',
    });
    var that = this;
    my.getStorage({
      key: 'token',
      success: function(res) {
        my.httpRequest({
          url: app.geturl+'/order/info',
          method: 'GET',
          data: {
            token: res.data.token,
            order_id:r.id
          },
          dataType: 'json',
          success: function(res) {
            if(res.data.code==0){
              console.info(res.data.data.Obj);
              that.setData({
                orderInfo: res.data.data.Obj
              })
            }else{
              app.memberLogin();
            }
          }
        });
      }
    });
    my.httpRequest({
      url: app.geturl+'/feedback/get-tel',
      method: 'POST',
      dataType: 'json',
      success: function(res) {
        that.setData({
          phone: res.data.data.tel
        });
      }
    });
  },
  onBlur(e) {
    this.setData({
      inputValue: e.detail.value,
    });
  },
  makePhoneCall(e) {
    var that = this;
    my.makePhoneCall({ number: that.data.phone });
  },
  add() {
    app.todos = app.todos.concat([{
      text: this.data.inputValue,
      compeleted: false,
    }]);

    my.navigateBack();
  },
  handleTap(){
    my.navigateTo({ url: '../todos/todos' });
  }
});
